<%@ page language="java" pageEncoding="utf-8"%>
<%@taglib prefix="s" uri="/struts-tags"%>
${aier_doctype}
<html <s:property value="aier_html_xmlns" escape="false"/>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta content="${aier_keyworks}" name="keywords">
<meta content="${aier_description}" name="description">
<title>${aier_title}</title>
<link rel="stylesheet" href="${aier_css_url}${aier_jqui_css}ui.css" />
<link rel="Stylesheet" href="${aier_css_url}jq/jq.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/jq-msg.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/module/reset.css" />
<link rel="stylesheet"
	href="${aier_css_url}social/user/retrievePwd/common.css" />
<link rel="stylesheet" href="${aier_css_url}social/user/retrievePwd/icon.css" />
<link rel="stylesheet" href="${aier_css_url}social/user/retrievePwd/iv.css" />
<link rel="stylesheet" href="${aier_css_url}social/module/btn.css" />

<script type="text/javascript" src="${aier_js_url}j.js"></script>
<script type="text/javascript" src="${aier_js_url}b.js"></script>
<script type="text/javascript" src="${aier_js_url}lib/block.js"></script>
<script type="text/javascript" src="${aier_js_url}jp/msg.js"></script>
</head>
<!-- 身份验证 -->
<body>
	<div class="rp-bg">
		<div class="rp-content">
			<div class="rp-logo rp-icon rp-icon-logo"></div>
			<div class="rp-main">
				<div class="rp-main-top">
					<div class="top-title rp-icon rp-icon-title"></div>
				</div>
				<div class="rp-main-middle">
					<div class="middle-line rp-icon rp-icon-line"></div>
					<div class="middle-tabs clearfix">
						<div class="tabs-idv rp-icon-tabs rp-icon-tabs-1"></div>
						<div class="tabs-rep rp-icon-tabs rp-icon-tabs-4"></div>
						<div class="tabs-com rp-icon-tabs rp-icon-tabs-6"></div>
					</div>

					<div class="middle-content">
						<div class="content-phone">
							<div class="phone-line clearfix">
								<div class="c-ipnut-name">
									<label for="rpPhone">手机号码：</label>
								</div>
								<div class="c-ipnut-area clearfix">
									<div class="ipnut-area-normal">
										<input class="PY-input" type="text" id="rpPhone">
									</div>
									<div class="ipnut-area-tip clearfix">
										<div class="tip-pro">
											<i id="ivMobileIcon" class="phone-c-icon rp-icon "></i> <span
												id="ivMoblieWarning"></span>
										</div>
									</div>
								</div>


							</div>
							<div class="phone-line clearfix">
								<div class="c-ipnut-name">
									<label for="rpCode">验证码：</label>
								</div>
								<div class="c-ipnut-area clearfix">
									<div class="ipnut-area-normal">
										<a id="getVcode" class="btn-getcode phone-c-send">
											<span>免费获取短信验证码</span>
										</a>
									</div>
									<div class="ipnut-area-normal phone-code">
										<input style="width: 50px;" class="PY-input" type="text"
											id="rpCode">
									</div>
									<div class="ipnut-area-tip clearfix">
										<div class="tip-pro">
											<i id="ivCodeIcon" class="phone-c-icon rp-icon "></i> <span
												id="ivCodeWarning"></span>
										</div>
									</div>
								</div>


							</div>
							<div class="phone-line clearfix">
								<div class="c-ipnut-name"></div>
								<div class="c-ipnut-area clearfix">
									<a id="ivNext" href="javascript:;"
										class="rp-next-btn rp-icon rp-next-btn"></a>

								</div>


							</div>


						</div>

					</div>
				</div>
				<div class="rp-main-bottom"></div>
			</div>

		</div>
	</div>
</body>

<script type="text/javascript">

	//判断输入的手机号码是否正确
	var flag_phone = false;
	function check_moblieNum() {
		var moblieNum = $("#rpPhone").val();
		if (moblieNum.trim() == "") {
			$("#ivMobileIcon").attr("class", "rp-icon-fork phone-c-icon rp-icon");
			$("#ivMoblieWarning").html("请输入手机号码！");
		} else if (!check_mobile(moblieNum)) {
			$("#ivMobileIcon").attr("class","rp-icon-fork phone-c-icon rp-icon ");
			$("#ivMoblieWarning").html("输入的手机号码格式错误！");
		} else {
			var fun = function(data) {
				if(data.s==1){
					$("#ivMobileIcon").attr("class","rp-icon-hook phone-c-icon rp-icon ");
					$("#ivMoblieWarning").html("");
					flag_phone = true;				
				}else{
					$("#ivMobileIcon").attr("class","rp-icon-fork phone-c-icon rp-icon ");
					$("#ivMoblieWarning").html(data.error_info);
				}
			};
			exeAjax(ajaxUrl("${aier_url}${aier_urijs}retpwd_checkPhone${aier_suffix}"), fun, 
				{"account" :moblieNum});	
		}
	}
	$("#rpPhone").live('input',function() {
        check_moblieNum();
    });
	$("#rpPhone").blur('input',function() {
		check_moblieNum();
	});
	
	//获取手机验证码
	//下一步
	$("#getVcode").click(function() {
		if(flag_phone){
			if (!$(this).hasClass('btn-getcode-disabled')) {
				$('#getVcode').addClass('btn-getcode-disabled');
				$('#getVcode>span').html('<em>60</em>秒后再次获取');
			
				var rTime = 60;
				function countdown() {
					rTime -= 1;
					// console.log(rTime);
					if ( rTime < 1 ) {
						clearInterval(cs);
						$('#getVcode').removeClass('btn-getcode-disabled');
						$('#getVcode>span').html('免费获取短信激活码');
					} else {
						$('#getVcode>span>em').html(rTime);
					}
				};
				var cs = setInterval(countdown,1000);	
			
				var fun = function(data) {};
				exeAjax(
					ajaxUrl("${aier_url}${aier_urijs}userregindex_showPhoneMessage${aier_suffix}"),
				 	fun,
				  	{"account" :$("#rpPhone").val()}
				);
			}
		}else{
			$().message("请先输入正确的手机号!");
		}
	});
	
	
	//判断输入的验证码是否正确
	var flag_code = false;
	function check_codeNum() {
		var codeNum = $("#rpCode").val();
		if (codeNum.trim() == "") {
			$("#ivCodeIcon").attr("class","rp-icon-fork phone-c-icon rp-icon");
			$("#ivCodeWarning").html("请输入验证码！");
		}else {
			$("#ivCodeIcon").attr("class","rp-icon-hook phone-c-icon rp-icon ");
			$("#ivCodeWarning").html("");
			flag_code = true;	
		}

	}
	$("#rpCode").blur(function(){
		check_codeNum();
	});
	
	
	//下一步
	$("#ivNext").click(function() {
		var codeNum = $("#rpCode").val();
		var moblieNum = $("#rpPhone").val();
		if(flag_phone&&flag_code){
			var fun = function(data) {
				if(1==data.s){
					window.location.href = "${aier_url}${aier_uri}retpwd_resetPwd.shtml?account="+moblieNum;
				}else{
					$().message("验证码有误");
				}
			};
			exeAjax(ajaxUrl("${aier_url}${aier_urijs}retpwd_checkCode${aier_suffix}"), fun, 
				{"account" : moblieNum,"message" :codeNum});		
		}else{
			$().message("输入有误");
		}	
	});
	
</script>
</html>